cmake_minimum_required(VERSION 3.16)

# 设置CMake策略
cmake_policy(SET CMP0144 NEW)
cmake_policy(SET CMP0167 NEW)

project(HelloWorld)

# 添加Boost库头文件路径


# 设置Boost库路径
set(Boost_ROOT "D:/code/boost/boost_1_86_0_exe/")
set(Boost_INCLUDEDIR ${Boost_ROOT})
# set(Boost_LIBRARYDIR ${Boost_ROOT}/stage/lib)
set(Boost_LIBRARYDIR ${Boost_ROOT}/lib64-msvc-14.3)
include_directories("${Boost_ROOT}")


set(Boost_LIBRARIES 
            "${Boost_LIBRARYDIR}/libboost_log-vc143-mt-x64-1_86.lib"
            "${Boost_LIBRARYDIR}/libboost_log_setup-vc143-mt-x64-1_86.lib"
            "${Boost_LIBRARYDIR}/libboost_filesystem-vc143-mt-x64-1_86.lib"
            "${Boost_LIBRARYDIR}/libboost_system-vc143-mt-x64-1_86.lib"
            "${Boost_LIBRARYDIR}/libboost_thread-vc143-mt-x64-1_86.lib"
            "${Boost_LIBRARYDIR}/libboost_atomic-vc143-mt-x64-1_86.lib"
            "${Boost_LIBRARYDIR}/libboost_date_time-vc143-mt-x64-1_86.lib"
            "${Boost_LIBRARYDIR}/libboost_regex-vc143-mt-x64-1_86.lib"
            "${Boost_LIBRARYDIR}/libboost_exception-vc143-mt-x64-1_86.lib"
            "${Boost_LIBRARYDIR}/libboost_chrono-vc143-mt-x64-1_86.lib"
        )

# 设置C++标准
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 设置调试信息
if(MSVC)
    # 强制使用Release运行时库，这样Debug模式也可以链接Release库
    set(CMAKE_CXX_FLAGS_DEBUG "/Zi /Od /MD")
    set(CMAKE_CXX_FLAGS_RELEASE "/O2 /MD")
    # 设置通用编译标志
    set(CMAKE_CXX_FLAGS "/utf-8 /EHsc")
endif()

file(GLOB_RECURSE SRC_HTTP_SERVER "src/log/*.cpp")
file(GLOB_RECURSE SRC_LOG "src/http_server/*.cpp")
# 创建可执行文件
add_executable(HelloWorld src/main.cpp ${SRC_LOG} ${SRC_HTTP_SERVER})

# 设置运行时库类型 - 强制使用Release运行时库
if(MSVC)
    set_property(TARGET HelloWorld PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
endif()

# 链接Boost库
target_link_libraries(HelloWorld ${Boost_LIBRARIES}) 